<include file="Public:schedule_header" title="本月日常安排" />
  <div class="module_public_main">
     <table>
       <if condition="$days eq '30'">
       <for start="1" end="31">
           <if condition="$now_day eq $i">
           <tr>
           <td width="8%" align="right" bgcolor="#cccccc"><{$month}>月<{$i}>号:</td>
           <td class="input_text" title="<{$i}>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
           </tr>
           <else />
           <tr>
           <td width="8%" align="right"><{$month}>月<{$i}>号:</td>
           <td class="input_text" title="<{$i}>">&nbsp;<a href="#" class="s_look">[查看当天安排]</a></td>
           </tr>
           </if>
       </for>
       <elseif condition="$days eq '28'" />
       <for start="1" end="29">
         <if condition="$now_day eq $i">
         <tr>
         <td width="8%" align="right" bgcolor="#cccccc"><{$month}>月<{$i}>号:</td>
         <td class="input_text" title="<{$i}>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
         </tr>
         <else />
         <tr>
         <td width="8%" align="right"><{$month}>月<{$i}>号:</td>
         <td class="input_text" title="<{$i}>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
         </tr>
         </if>
       </for>
       <else />
       <for start="1" end="32">
          <if condition="$now_day eq $i">
          <tr>
          <td width="8%" align="right" bgcolor="#cccccc"><{$month}>月<{$i}>号:</td>
          <td class="input_text" title="<{$i}>" name="<{$month}>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
          </tr>
          <else />
          <tr>
          <td width="8%" align="right"><{$month}>月<{$i}>号:</td>
          <td class="input_text" title="<{$i}>" name="<{$month}>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
          </tr>
          </if>
       </for>
       </if>
     </table>
  </div>
  <script type="text/javascript">
    $(function(){
	//获取到双击的相应表格，并创建INPUT输入框
	$(".input_text").dblclick(function(){
		var days = $(this).attr("title");
		var months = $(this).attr("name");
		$(this).html("<input type='text' id='text_v' value='请输入日常安排...' style='width:100%;height:20px;'/>");	
			
		  //焦点到INPUT输入框时
		  $("#text_v").focus(function(){
			 var val = this.value;
		     if(this.value == "请输入日常安排..."){
				this.value = ""; 
			 }else{
				this.value = val;  
			 }
	      });
		  
		  $("#text_v").blur(function(){
			 var value = this.value;
			 
			 $.get("__URL__/save_input",{
				 v : value, 
				 day : days,
				 month : months
			 },function(data){
				 if(data=="1"){
					alert("日程安排成功"); 
					location.reload();
				 }else{
					alert("日程安排失败,请重新尝试"); 
				 }
			 });
			 
			 $(this).remove();
		  });	
	})
	
	//查看日程安排
	$(".s_look").click(function(){
	   $this_element = $(this);
	   $day = $(this).parent().attr("title");
	   $month = $(this).parent().attr("name");
	   $.get("__URL__/look_schedule",{
		   day : $day, 
		   month : $month
	   },function(data){
		   $this_element.parent().html(data); 
	   });
	   return false;
	});
});  
  </script>
<include file="Public:schedule_footer" />